fix: 포트폴리오 개인/외주 구분을 선택 입력으로 변경 - #177
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthrough프로젝트 완료 시 Changes포트폴리오 kind 선택 입력 전환
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant Client
participant ProjectController
participant ProjectService
participant PortfolioService
Client->>ProjectController: 프로젝트 완료 요청
ProjectController->>ProjectService: 완료 처리 호출
ProjectService->>PortfolioService: 프로젝트 정보로 포트폴리오 생성
PortfolioService-->>ProjectService: kind가 null인 포트폴리오 반환
ProjectService-->>ProjectController: 완료 결과 반환
ProjectController-->>Client: 성공 응답
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/java/com/slatto/domain/project/service/ProjectService.java (1)
220-232: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
kind만 선택 입력으로 바꾸고title검증은 유지해야 합니다.Line 223 부근에서 제목과
kind를 함께 검사하던 완료 전 검증을 모두 제거했습니다. PR objective는kind만 선택 입력으로 변경합니다.PortfolioService.createProjectPortfolios는project.getTitle()을UserPortfolio.create로 전달하고,UserPortfolio.title은nullable = false입니다. 제목이 null인 프로젝트가 완료되면 포트폴리오 저장이 DB 제약 위반으로 실패합니다. 빈 문자열이면 기존@NotBlank계약도 우회합니다.kind조건만 제거하고 제목 조건은 별도 오류 코드로 유지하세요.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/main/java/com/slatto/domain/project/service/ProjectService.java` around lines 220 - 232, Restore title validation in the completion flow around completeProject while keeping kind optional by removing only the kind check. Reject null or blank project titles with the existing dedicated title-validation error code before markCompleted or portfolio creation, preserving the current behavior for valid titles.
🧹 Nitpick comments (1)
src/test/java/com/slatto/domain/project/service/ProjectCompletionPortfolioTest.java (1)
185-210: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win
kind == null일 때clientName보존을 검증하세요.현재 테스트는
kind가 없는 완료만 검증하고clientName은 입력하지 않습니다. 따라서resolveClientName(null, clientName)이 실제 값으로 실행되지 않으며, nullkind에서clientName을 버리는 회귀도 통과합니다. 완료 요청에clientName을 추가하고 저장된 포트폴리오의 값을 검증하세요.테스트 보강 예시
private ProjectUpdateRequest completeRequestWithoutKind() { return request(""" - {"title":"종류 없는 프로젝트","type":"FILM_DRAMA","lengthType":"SHORT_FORM","description":"설명", + {"title":"종류 없는 프로젝트","type":"FILM_DRAMA","lengthType":"SHORT_FORM","description":"설명","clientName":"클라이언트 Y", "endDate":"%s","status":"COMPLETED"} """.formatted(LocalDate.now().plusDays(10))); } assertThat(portfolio.getTitle()).isEqualTo("종류 없는 프로젝트"); assertThat(portfolio.getKind()).isNull(); + assertThat(portfolio.getClientName()).isEqualTo("클라이언트 Y");🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/test/java/com/slatto/domain/project/service/ProjectCompletionPortfolioTest.java` around lines 185 - 210, Update completeProject_withoutKind_createsPortfolioWithNullKind and completeRequestWithoutKind() to supply a concrete clientName while kind remains null, then assert the saved portfolio preserves that clientName alongside the existing null-kind assertion. Ensure the test exercises resolveClientName(null, clientName) through the completion flow.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/main/java/com/slatto/domain/project/service/ProjectService.java`:
- Around line 220-232: Restore title validation in the completion flow around
completeProject while keeping kind optional by removing only the kind check.
Reject null or blank project titles with the existing dedicated title-validation
error code before markCompleted or portfolio creation, preserving the current
behavior for valid titles.
---
Nitpick comments:
In
`@src/test/java/com/slatto/domain/project/service/ProjectCompletionPortfolioTest.java`:
- Around line 185-210: Update
completeProject_withoutKind_createsPortfolioWithNullKind and
completeRequestWithoutKind() to supply a concrete clientName while kind remains
null, then assert the saved portfolio preserves that clientName alongside the
existing null-kind assertion. Ensure the test exercises resolveClientName(null,
clientName) through the completion flow.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: cd830b53-27d4-4459-8e0e-e67e36bd28d6
📒 Files selected for processing (9)
src/main/java/com/slatto/domain/project/controller/ProjectController.javasrc/main/java/com/slatto/domain/project/exception/ProjectErrorCode.javasrc/main/java/com/slatto/domain/project/service/ProjectService.javasrc/main/java/com/slatto/domain/user/controller/PortfolioController.javasrc/main/java/com/slatto/domain/user/dto/PortfolioCreateRequest.javasrc/main/java/com/slatto/domain/user/entity/UserPortfolio.javasrc/main/java/com/slatto/domain/user/service/PortfolioService.javasrc/main/resources/db/migration/V022__portfolio_kind_nullable.sqlsrc/test/java/com/slatto/domain/project/service/ProjectCompletionPortfolioTest.java
🔗 관련 이슈 (Related Issue)
Closes #176
📝 작업 내용
포트폴리오의 개인/외주 구분(
kind)을 필수에서 선택 입력으로 바꿨습니다. 목록 조회나 필터에 쓰이지 않는 값이라 등록 단계에서 선택을 강요할 이유가 없었습니다.주요 변경 사항
PortfolioCreateRequest.kind의@NotNull제거,UserPortfolio.kind를 nullable 로 변경kind검증과PROJECT_COMPLETION_INFO_REQUIRED제거V022__portfolio_kind_nullable.sql추가상세 내용
1. 의뢰자 저장 조건을 뒤집었습니다
기존 조건이면
kind를 비웠을 때 의뢰자까지 함께 사라집니다. 개인 작업으로 명시한 경우에만 비우도록 바꿔, 구분 없이 의뢰자만 입력하는 것을 허용했습니다.2. 프로젝트 완료 검증이 죽은 코드가 되어 제거했습니다
이 검증은 포트폴리오의
kind가 NOT NULL 이라 자동 생성이 실패하는 것을 막으려고 넣은 것입니다. nullable 이 되면서 실패 가능성이 사라졌고, 남는 조건인title은 프로젝트 생성·수정 요청 모두@NotBlank라 비어질 수 없어 발동하지 않습니다.ProjectController의@ApiErrorCodes에서도PROJECT_COMPLETION400을 함께 뺐습니다.ErrorCodeRegistry는 등록되지 않은 코드를 만나면 예외를 던지므로 한쪽만 고치면 문서 생성이 실패합니다.3. 마이그레이션에서 ENUM 을 VARCHAR 로 함께 전환했습니다
운영 DB 는
ddl-auto=update로 생성된 구간이 있어 이 컬럼이 MySQL ENUM 일 수 있습니다.V009(activity_log.type),V020(notification.type) 과 같은 처리를 했습니다.PERSONAL/EXTERNAL값은 문자열로 그대로 보존됩니다.제약 완화라 기존 코드가 동작 중인 DB 에 먼저 적용해도 안전합니다.
4. 테스트
기존 검증 테스트를 삭제하지 않고 새 동작 검증으로 교체했습니다.
전체 테스트 스위트 통과를 확인했습니다.
5. 프론트엔드 영향
POST /api/v1/users/me/portfolioskind가 필수에서 선택으로 변경GET /api/v1/users/me/portfolios/{portfolioId}kind가null로 내려올 수 있음PATCH /api/v1/projects/{projectId}PROJECT_COMPLETION400제거등록 폼에서 개인/외주 선택을 필수 해제하고, 이력 카드에 구분을 표시한다면 값이 없는 경우 처리가 필요합니다.
✅ PR 체크리스트
Summary by CodeRabbit